<template>
  <el-container>
    <!-- 头部区域 -->
    <el-header>
      <Header :title="title" />
    </el-header>

    <!-- 页面主体区域 -->
    <el-container>
      <!-- 侧边栏 -->
      <Aside :asideInfo="asideInfo" />
      <el-main>
        <router-view></router-view>
      </el-main>
    </el-container>
  </el-container>
</template>

<script>
import Header from "@/components/Header";
import Aside from "@/components/Aside";
export default {
  name: "Home",
  data() {
    return {
      title: "大学生失物招领系统",
      asideInfo: [
        { id: 1, name: "物品发布", path: "/home/goodissus" },
        { id: 2, name: "用户管理", path: "/home/usermanage" },
        { id: 3, name: "个人信息", path: "/home/usermessage" },
      ],
    };
  },
  components: { Header, Aside },
  props: ["userInfo"],
  mounted() {
    //判断用户是否登入
    if (!window.sessionStorage.getItem("token")) {
      this.$router.push("/login");
    }
  },
};
</script>

<style lang="less" scoped>
// 头部
.el-header {
  padding: 0;
}
// 主体区域
.el-container {
  height: 100%;
}

.el-main {
  background-color: #e9eef3;
  color: #333;
  text-align: center;
  line-height: 160px;
}
</style>
